//
//  CompanyHelpStore.m
//  NewPro
//
//  Created by RYX on 2018/10/31.
//  Copyright © 2018年 何荧红. All rights reserved.
//

#import "CompanyHelpStore.h"
#import "CompanyNewsModel.h"
#import "HandleCardModel.h"
#import "BorrowMoneyModel.h"

@implementation CompanyHelpStore

#pragma mark - 行业新闻
- (void)getNewsListSuccess:(void(^)(NSArray *listArr))success Failure:(void(^)(NSError *error))failure{
    
    NSString *url = [NSString stringWithFormat:@"%@/api/assistance/news",IP];
    NSDictionary *dic = @{
                          
                          };
    [HttpTool postUrlWithString:url parameters:dic success:^(id responseObject) {
        
        NSError *error = [HttpTool inspectError:responseObject];
        
        if (error == nil) {
            
            NSArray *arr = [CompanyNewsModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"items"]];
            success(arr);
        }else{
            
            failure(error);
        }
        
    } failure:^(NSError *error) {
       
        failure(error);
    }];
}

#pragma mark - 在线办卡
- (void)handleCardListSuccess:(void(^)(NSArray *listArr))success Failure:(void(^)(NSError *error))failure{
    
    NSString *url = [NSString stringWithFormat:@"%@/api/assistance/zxbk",IP];
    NSDictionary *dic = @{
                          
                          };
    [HttpTool postUrlWithString:url parameters:dic success:^(id responseObject) {
        
        NSError *error = [HttpTool inspectError:responseObject];
        
        if (error == nil) {
            
            NSArray *arr = [HandleCardModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"items"]];
            success(arr);
        }else{
            
            failure(error);
        }
        
    } failure:^(NSError *error) {
        
        failure(error);
    }];
}

#pragma mark - 我要借款
- (void)borrowMoneyListSuccess:(void(^)(NSArray *listArr))success Failure:(void(^)(NSError *error))failure{
    
    NSString *url = [NSString stringWithFormat:@"%@/api/assistance/wyjk",IP];
    
    NSDictionary *dic = @{
                          
                          };
    
    [HttpTool postUrlWithString:url parameters:dic success:^(id responseObject) {
        
        NSError *error = [HttpTool inspectError:responseObject];
        
        if (error == nil) {
            
            NSArray *arr = [BorrowMoneyModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"items"]];
            success(arr);
        }else{
            
            failure(error);
        }
        
    } failure:^(NSError *error) {
        
        failure(error);
    }];
}

@end
